import Vue from 'vue'
import Router from 'vue-router'
import Zhujiemian from '@/components/Zhujiemian'
import Index from '@/components/Fenqu/Index.vue'
import Pd from '@/components/Fenqu/Pd.vue'
import Dt from '@/components/Fenqu/Dt.vue'
import Hyg from '@/components/Fenqu/Hyg.vue'

Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '/',
      name: 'Zhujiemian',
      component: Zhujiemian,
      redirect: '/Index',
      children: [
        {
          path: '/Index',
          name: 'Index',
          component: Index
        },
        {
          path: '/Pd',
          name: 'Pd',
          component: Pd
        },
        {
          path: '/Dt',
          name: 'Dt',
          component: Dt
        },
        {
          path: '/Hyg',
          name: 'Hyg',
          component: Hyg
        }
      ]
    }

  ]
})
router.beforeEach((to, from, next) => {
  // console.log(to, from);
  if (to.name !== from.name) {
    next()
  }

})
export default router